package com.exam.controller;

import com.exam.dao.StuLoginMapper;
import com.exam.pojo.Admin;
import com.exam.service.StuLoginService;
import com.exam.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/login")
public class StuLoginController {

    @Autowired
    private StuLoginService stuLoginService;
    @Autowired
    private StuLoginMapper stuLoginMapper;

    @GetMapping
    public Result getAll(){
        List<Admin> list = stuLoginMapper.selectList(null);
        return new Result(true,list);
    }

    @PostMapping
    @ResponseBody
    public Result getLogin(@RequestBody Admin admin){
        return new Result(true, stuLoginService.getLogin(admin));
    }
}
